home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 1998 June / SGI IRIX 6.5 Applications 1998 June.iso / dist / outbox.idb / var / tmp / tmp_install_outbox1.3.z / tmp_install_outbox1.3
Text File  |  1998-05-04  |  2KB  |  75 lines

  1. #!/bin/sh
  2.  
  3. #
  4. # Update DES 1.x and IRIX 6.2 OutBox pages to work with 6.3
  5. #     1. add toolbars to unmodified OutBox pages for machine and users
  6. #     2. add links for index.shtml for SSI pages
  7. #
  8.  
  9. # add toolbar to page if it can be identified as an OutBox machine page
  10.  
  11. indexFile=/var/www/htdocs/index.html
  12. sIndexFile=/var/www/htdocs/index.shtml
  13. tmpFile=/var/tmp/index.html.$$
  14.  
  15. if [ -w $indexFile ] ; then
  16.     if grep '/cgi-bin/machine-cgi' $indexFile >/dev/null 2>&1 ; then
  17.         :
  18.     elif grep '/var/www/htdocs/userList' $indexFile >/dev/null 2>&1 ; then
  19.         # set up .shtml link for new webserver config
  20.         if [ ! -f $sIndexFile ] ; then
  21.             ln -sf index.html $sIndexFile
  22.         fi
  23.         # add toolbar to existing OutBox machine page
  24.         sed -e "s:^<img src=/images/poweredsgi.gif><p><br>$:\
  25. <!--DO NOT REMOVE--><!--#exec cgi=\"/cgi-bin/machine-cgi\" -->\
  26. :" $indexFile > $tmpFile
  27.         cmp -s $indexFile $tmpFile >/dev/null 2>&1
  28.         if [ $? = 1 ] ; then
  29.             cp -f $tmpFile $indexFile
  30.         fi
  31.     fi
  32. fi
  33.  
  34. # add toolbar to page if it can be identified as an OutBox user page
  35.  
  36. for file in /var/www/htdocs/*
  37. do
  38.     indexFile=$file/index.html
  39.     sIndexFile=$file/index.shtml
  40.     if [ -w $indexFile ]
  41.     then
  42.         user=`echo $file | sed -e "s:/var/www/htdocs/::" 2>/dev/null`
  43.         if grep '/cgi-bin/outbox-cgi' $indexFile >/dev/null 2>&1
  44.         then
  45.             :
  46.         elif grep '/cgi-bin/wrap' $indexFile >/dev/null 2>&1
  47.         then
  48.             # add link for SSI file index.shtml
  49.             uid=`/usr/bin/id -un $user 2>/dev/null`
  50.             gid=`/usr/bin/id -gn $user 2>/dev/null`
  51.             # set up .shtml link for new webserver config
  52.             if [ ! -f $sIndexFile ]
  53.             then
  54.                 ln -sf index.html $sIndexFile
  55.                 chown -hf $uid $sIndexFile
  56.                 chgrp -hf $gid $sIndexFile
  57.             fi
  58.             # add toolbar to top of page
  59.             sed -e "s:\(<[bB][oO][dD][yY].*>\):\1\
  60. <!--DO NOT REMOVE--><!--#exec cmd=\"/var/www/cgi-bin/outbox-cgi /$user\" -->\
  61. :" $indexFile > $tmpFile 2>/dev/null
  62.             cmp -s $indexFile $tmpFile >/dev/null 2>&1
  63.             if [ $? = 1 ]
  64.             then
  65.                 cp -f $tmpFile $indexFile
  66.                 chown -hf $uid $indexFile
  67.                 chgrp -hf $gid $indexFile
  68.             fi
  69.         fi
  70.     fi
  71. done
  72.  
  73. rm -f $tmpFile
  74.  
  75.